home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1994 March / Internet Info CD-ROM (Walnut Creek) (March 1994).iso / networking / ip / ka9q / osrc.arc / UDPCMD.C < prev    next >
Encoding:
C/C++ Source or Header  |  1989-03-28  |  1.1 KB  |  52 lines

  1. /* UDP-related user commands */
  2. #include <stdio.h>
  3. #include "global.h"
  4. #include "mbuf.h"
  5. #include "netuser.h"
  6. #include "udp.h"
  7. #include "internet.h"
  8. #include "cmdparse.h"
  9.  
  10. extern struct udp_stat Udp_stat;
  11. char *pinet();
  12. int doudpstat();
  13.  
  14. struct cmds Udpcmds[] = {
  15.     "status",    doudpstat,    0, 0,    NULLCHAR,
  16.     NULLCHAR,    NULLFP,        0, 0,"udp subcommands: status",
  17. };
  18.  
  19. doudp(argc,argv,envp)
  20. int argc;
  21. char *argv[];
  22. void *envp;
  23. {
  24.     return subcmd(Udpcmds,argc,argv,envp);
  25. }
  26. /* Dump UDP statistics and control blocks */
  27. doudpstat()
  28. {
  29.     register struct udp_cb *udp;
  30.     register int i;
  31.  
  32.     printf("sent %u rcvd %u bdcsts %u cksum err %u unknown socket %u\n",
  33.     Udp_stat.sent,Udp_stat.rcvd,Udp_stat.bdcsts,Udp_stat.cksum,Udp_stat.unknown);
  34.     printf("    &UCB Rcv-Q  Local socket\n");
  35.     for(i=0;i<NUDP;i++){
  36.         for(udp = Udps[i];udp != NULLUDP; udp = udp->next){
  37.             st_udp(udp,1);
  38.         }
  39.     }
  40. }
  41. st_udp(udp,n)
  42. struct udp_cb *udp;
  43. int n;
  44. {
  45.     if(n == 0)
  46.         printf("    &UCB Rcv-Q  Local socket\n");
  47.  
  48.     printf("%8lx%6u  %s\n",ptol(udp),udp->rcvcnt,
  49.      pinet(&udp->socket));
  50.  
  51. }
  52.